<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

<title>登录</title>
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
<link href="${path }/resource/css/login.min.css" rel="stylesheet">


<!--[if lt IE 8]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
<script>
	if (window.top !== window.self) {
		window.top.location = window.location
	};
</script>

</head>

<body class="signin" onkeypress="dologin(event)">
	<div class="signinpanel">
		<div class="row">
			<div class="col-sm-7">
				<div class="signin-info">
					<div class="logopanel m-b">
						<h1>[ 锑都商讯 ]</h1>
					</div>
					<div class="m-b"></div>
					<h4>
						欢迎使用 <strong></strong>
					</h4>
					<ul class="m-b">
						<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 买房</li>
						<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 买房</li>
						<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 租房</li>
					</ul>
				</div>
			</div>
			<div class="col-sm-5">
				<form method="post" method="post" class="dataForm">
					<h4 class="no-margins">登录：</h4>
					<input id="account" type="text" placeholder="账户"
						class="form-control uname" name="account" /> <input id="password"
						type="password" class="form-control pword m-b" name="password"
						nullmsg="密码不能为空" placeholder="密码" /> <a href="">　　</a>
					<button type="button" onclick="login()"
						class="btn btn-success btn-block">登录</button>
				</form>
			</div>
		</div>
		<div class="signup-footer">
			<div class="pull-left">&copy; 2016 All Rights Reserved.</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	function login() {
		if ($("#account").val() == "") {
			layer.tips('请输入账号！', '#account');
			return false;
		} else if ($("#password").val() == "") {
			layer.tips('请输入密码！', '#password');
			return false;
		}
		var redirect=$.query.get("redirect");
		console.log(redirect);
		$.AjaxProxy({
			p : {
				account : $("#account").val(),
				password : $("#password").val()
			}
		}).invoke("${path}/common/dologin", function(loj) {
			if(redirect){
				MTools.redirect("${path}/" + loj.getValue(redirect));
			}else{
				MTools.redirect("${path}/" + loj.getValue("page"));
			}
		});
	}
	function dologin(e) {
		if (e.keyCode == 13) {
			e.preventDefault();
			window.event.returnValue = false;
			login();
			return false;
		}
	}
</script>
</html>